package com.yq.design.iterator;

import java.util.Iterator;

/**
 * @ClassName ComputerCollege
 * @Description TODO
 * @Author yaoqiang
 * @Date 2021/8/24 11:52
 * @Version 1.0
 */
public class ComputerCollege  implements  College{
    Department[] departments;
    int num=0;

    public ComputerCollege() { departments=new  Department[5]; addDepartment("java","java");addDepartment("php","php"); }

    @Override
    public String getName() {
        return "计院";
    }

    @Override
    public Iterator createIterator() {
        return new ComputerIterator(departments);
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department=new Department(name,desc);
        departments[num]=department;
        num+=1;
    }
}
